from django.core.management.base import BaseCommand

from itpay.core.agency import agency_service
from itpay.core.agency.const import AgencyType


class Command(BaseCommand):
    def handle(self, *args, **options):
        _, agencys = agency_service.list_agency(1, 20, working=True, agency_type=AgencyType.NORMAL_AGENCY,
                                                balance_lt=200000)

        for agency in agencys:
            agency_service.agency_go_off_work(agency['id'], remark='off work by not enough balance scan')
